//
//  videoPlugin.m
//  挠挠
//
//  Created by chabao on 2018/5/7.
//

#import "videoPlugin.h"
#import "photoAlbumViewController.h"
#import "camerViewController.h"

@implementation videoPlugin

-(void)getFromCamer:(CDVInvokedUrlCommand *)command  {
    __weak videoPlugin *weakSelf = self;
    camerViewController *vc = [[camerViewController alloc] init];
    //    vc.callBackBlock =  ^( NSArray *dataArray){
    //        CDVPluginResult *pluginResult = nil;
    //        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray: dataArray];
    //        [weakSelf.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
    //    };
    [self.commandDelegate runInBackground:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            vc.hidesBottomBarWhenPushed = YES;
            UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
            [weakSelf.viewController presentViewController:nav animated:NO completion:nil];
        });
    }];

}
-(void)getFromPhotoAlbum:(CDVInvokedUrlCommand *)command  {
    __weak videoPlugin *weakSelf = self;
    photoAlbumViewController *vc = [[photoAlbumViewController alloc] init];
//    vc.callBackBlock =  ^( NSArray *dataArray){
//        CDVPluginResult *pluginResult = nil;
//        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray: dataArray];
//        [weakSelf.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
//    };
    [self.commandDelegate runInBackground:^{
        dispatch_async(dispatch_get_main_queue(), ^{
            vc.hidesBottomBarWhenPushed = YES;
            UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
            [weakSelf.viewController presentViewController:nav animated:NO completion:nil];
        });
    }];
    

}
@end

